home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Washington_1988 / DevCon88.2 / IFF / PGTB / td.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  4.0 KB  |  146 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 
  2. /* |_o_o|\\   The Software Distillery                         */ 
  3. /* |. o.| ||  Made available for the Amiga development community         */ 
  4. /* | .    | ||   author:                           BBS:      */ 
  5. /* | o    | ||   John Mainwaring                     (919)-471-6436  */ 
  6. /* |  . |//                                     */ 
  7. /* ======                                     */ 
  8. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 
  9.  
  10. /* global definitions for traceback dump utility */ 
  11.  
  12. #include "exec/types.h" 
  13. #include "exec/memory.h" 
  14. #include "proto/exec.h" 
  15. #include "stdio.h" 
  16. #include "string.h" 
  17. #include "stdlib.h" 
  18.  
  19. #define FATAL 20 
  20.  
  21. /* bit flags for dump options */ 
  22. #define SYMFLG        1<<0 
  23. #define FAILFLG     1<<1 
  24. #define REGFLG        1<<2 
  25. #define ENVFLG        1<<3 
  26. #define STAKFLG        1<<4 
  27. #define UDATFLG        1<<5 
  28. #define FMEMFLG     1<<6 
  29. #define TRACEFLG    1<<7 
  30.  
  31. struct symbol_node { 
  32.    struct symbol_node * sn_next; 
  33.    long sn_memsize; 
  34.    ULONG sn_value; 
  35.    char sn_sym[4]; /* real length determined when allocated */ 
  36.    }; 
  37.  
  38. struct line_elem { 
  39.    ULONG le_line; 
  40.    ULONG le_off; 
  41.    }; 
  42.  
  43. struct line_node { 
  44.    struct line_node * ln_next; 
  45.    ULONG ln_size;    /* byte size of this block            */ 
  46.    ULONG ln_codesize;    /* byte size of this object file        */ 
  47.    ULONG ln_letabsize;    /* number of line_elems for this object file    */ 
  48.    ULONG ln_offset;    /* offset into segment of this object file    */ 
  49.    ULONG ln_nsize;    /* length of name (in longwords)        */ 
  50.    char  ln_name[4];    /* name of object file lines belong to        */ 
  51.             /* a table of line_elem comes after full name    */ 
  52.    }; 
  53.  
  54. /* element of table of seglist descriptors */ 
  55. struct segment { 
  56.    long addr; 
  57.    long size; 
  58.    struct symbol_node *symbols; 
  59.    struct line_node *lines; 
  60.    }; 
  61.  
  62. /* element of UDAT chain */ 
  63. struct udata { 
  64.    struct udata *udptr; 
  65.    long udsize; 
  66.    long udat[1];  /* actual length of array given by udsize */ 
  67.    }; 
  68.  
  69. /* data structure to hold contents of PGTB traceback file */ 
  70. struct tbtemplate { 
  71.    /* FAIL stuff */ 
  72.    long  gotfail;    /* found FAIL chunk        */ 
  73.    char *taskname;    /* name from task block        */ 
  74.    ULONG environ,    /* H/W environment        */ 
  75.      vbfreq,    /* Vertical Blank        */ 
  76.      psfreq,    /* Power Supply            */ 
  77.      starter,    /* 0 = WB else CLI        */ 
  78.      guru,        /* defined in alerts.h        */ 
  79.      segcount;    /* longword count        */ 
  80.    struct segment *segments; /* seglist            */ 
  81.    /* REGS stuff */ 
  82.    long  gotregs;    /* found REGS chunk        */ 
  83.    ULONG pc,        /* program counter        */ 
  84.      cc,        /* condition code reg        */ 
  85.      dregs[8],    /* D0-D7            */ 
  86.      aregs[8];    /* A0-A7            */ 
  87.    /* VERS stuff */ 
  88.    long  gotvers;    /* found VERS chunk        */ 
  89.    ULONG ver,        /* version of catch.o        */ 
  90.      rev;        /* revision of catch.o        */ 
  91.    char *filename;    /* name of catch.o        */ 
  92.    /* FMEM stuff */ 
  93.    long  gotfmem;    /* got FMEM chunk        */ 
  94.    ULONG memca,        /* available chip        */ 
  95.          memcm,        /* max chip            */ 
  96.      memcl,        /* largest chip            */ 
  97.       memfa,        /* available fast        */ 
  98.          memfm,        /* max fast            */ 
  99.      memfl;        /* largest fast            */ 
  100.    /* STAK stuff (pointer to data chain) */ 
  101.    ULONG staktop,    /* top of stack            */ 
  102.      stakptr,/* saved stack pointer            */ 
  103.      staklen,    /* bottom of stack        */ 
  104.      topseg,    /* bool top present        */ 
  105.      botseg,    /* bool bot present        */ 
  106.      seglen,    /* else entire size*/ 
  107.      stak[2048];    /* stack data, 8K bytes        */ 
  108.    /* UDAT stuff */ 
  109.    struct udata *udhead; 
  110.    }; 
  111.  
  112. struct addrinfo { 
  113.    long hunknum; 
  114.    long offset; 
  115.    char *name; 
  116.    char *objname; 
  117.    long line; 
  118.    long lineoff; 
  119.    }; 
  120.  
  121. /* templates for functions called from outside defining section */ 
  122.  
  123. /* defined in tdrutil.c */ 
  124. long getlong(FILE *); 
  125. long forcegetlong(FILE *); 
  126. void getblock(FILE *, ULONG *, long); 
  127. void getbytes(FILE *, ULONG *, long); 
  128. ULONG getascii(FILE *, char **); 
  129. void skiplong(FILE *, long); 
  130. void skipbytes(FILE *, long); 
  131.  
  132. /* defined in tdread.h */ 
  133. int  tdread(FILE *); 
  134.  
  135. /* defined in tdsym.h */ 
  136. int  readsym(FILE *); 
  137.  
  138. /* defined in tdump.c */ 
  139. void tdump(int); 
  140.  
  141. /* defined in tdwutil.c */ 
  142. void hexdump(FILE *, unsigned char *, long, long); 
  143. void longtoascii(ULONG, char *); 
  144. int  locaddr(ULONG, struct addrinfo *); 
  145.  
  146.